<?php
	/**
	 * BrowseController
	 * @author David Ivins
	 */
	class BrowseController extends CustomControllerAction
	{
		/**
		 * indexAction
		 */
		public function indexAction() { }

		/**
		 * latestAction
		 */
		public function latestAction()
		{
			$max_items = 3;
			$domain = $this->_config->domain->name->media;
			$dates = CommonGenerator::generateCurrentIso8601Dates();

			$query_str = "['date_inverted' >= '{$dates['inverted']}']";
			$response = $this->_sdb->query($domain, $query_str, $max_items);

			if ($response->isSetQueryResult()) 
			{ 
				$items = $response->getQueryResult()->getItemName();

				foreach ($items as $item) 
				{ 
					$media = new Media();
					$media->load($item);
					$title = $media->getAttribute('title');
					$filename = $media->getAttribute('filename');

					echo("$item - $title - <a href='http://s3.amazonaws.com/mobloggin-media/$filename'>here</a><br />\n");
				} 
			}
		}
		
		public function thumbsAction()
		{
			// 1216846628_25_20514
			// 640 X 480

			//$id = "1216846628_25_20514";
			//$thumb_mgr = new ThumbnailManager();
			//echo $thumb_mgr->getThumbnail($id, 160); 
			
			//$domain = $this->_config->domain->name->users;
			//$cool = new SDBManager($domain, "User");
			//$usr_db_mgr = new UserDBManager();
			//$objects = $usr_db_mgr->isUniqueFieldValue('username', 'davidivins666');
			//var_dump($objects);
		}
	}
